//进行API统一管理
import requests from './request';
import mockRequests from './mockAjax';


//三级联动接口
// /api/product/getBaseCategoryList
export const reqCategoryList=()=>{
    //发请求
    return requests({url:'/product/getBaseCategoryList',methods:"get"});
};

//获取banner 轮播图数据
export const reqGetBannerList = () => mockRequests.get("/banner");

//获取floor 数据
export const reqFloorList =()=>mockRequests.get('/floor');

//获取搜索模块数据
export const reqGetSearchInfo=(params)=>requests({url:'/list',method:'post',data:params});

//获取商品详情数据
export const reqGetGoodsInfo=(skuId)=>requests({url:`/item/${ skuId }`,method :'get'});

//将商品添加到购物车
export const reqAddCart=(skuId,skuNum)=>requests({url:`/cart/addToCart/${skuId}/${skuNum}`,method:'post'});

//获取购物车数据 /api/cart/cartList  get
export const reqGetCartList=()=>requests({url:`/cart/cartList`,method:'get'});

//切换商品选中状态 /api/cart/checkCart/{skuID}/{isChecked}    get
export const reqCheckCart=(skuID,isChecked)=>requests({url:`/cart/checkCart/${skuID}/${isChecked}`,method:'get'});

// 删除购物车商品/api/cart/deleteCart/{skuId}  DELETE
export const reqDeleteCart=(skuId)=>requests({url:`/cart/deleteCart/${skuId}`,method:'DELETE'});

//  /api/user/passport/sendCode/{phone} 获取验证码 get
export const reqGetCode=(phone)=>requests({url:`/user/passport/sendCode/${phone}`,method:'get'});

// /api/user/passport/register  16. 注册用户  POST
export const reqRegister=(data)=>requests({url:`/user/passport/register`,data,method:'post'});

//  /api/user/passport/login     2. 登录  post
export const reqLogin=(data)=>requests({url:`/user/passport/login`,data,method:'post'});

// /api/user/passport/auth/getUserInfo   token校验获取用户登录信息   get
export const reqGetUserInfo=()=>requests({url:'/user/passport/auth/getUserInfo',method:'get'});